﻿using UnityEngine;
using System.Collections;

public class EndGame : MonoBehaviour {


    /// <summary>
    /// Called at the creation of the game.
    /// </summary>
	void Start () {
        Screen.showCursor = true;       // the mouse cursor is on the screen

        // PlayerPrefs define global data than can be accessed and modified in other classes.
        // Test witch player won the game and update the view

        if (PlayerPrefs.GetInt("winner") == 1)
        {
            GameObject.Find("EndGameText").GetComponent<TextMesh>().text = "Player 1 won the game";
        }
        else if (PlayerPrefs.GetInt("winner") == 2)
        {
            GameObject.Find("EndGameText").GetComponent<TextMesh>().text = "Player 2 won the game";
        }            
	}
	

}
